<?php 
/**
 * Documentation, License etc.
 *
 * @package girafplace
 */
require_once 'include.php';
require_once '_functions.php';


if(!isset($_POST['username']) || !isset($_POST['password'])) {
	echo "You should not access this page directly. Please try again from the frontpage";
} else {
	Connect();

	$result = validateAdmin($_POST['username'],$_POST['password']);
  
	if(!$result) {
		echo "Login failed. Maybe you misspelled something?";
	} else {
		$_SESSION['adminId'] = $result;
		header('Location: index.php' ) ;
	}

  Close();
}
